﻿using Cordyceps.Demo.EntityFrameworkCore.EFCore;
using Cordyceps.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace Cordyceps.Demo.PostgresSql.DbMigrator.EFCore;

public class DemoMigrationsDbContext : CordycepsDbContextBase<DemoMigrationsDbContext>
{
    /// <summary>
    ///     构造函数
    /// </summary>
    /// <param name="options"></param>
    public DemoMigrationsDbContext(DbContextOptions<DemoMigrationsDbContext> options)
        : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        // 配置迁移历史表不使用双引号（即使用小写）
        // modelBuilder.Entity<HistoryRow>().ToTable("__efmigrationshistory", t => t.ExcludeFromMigrations());

        base.OnModelCreating(modelBuilder);

        modelBuilder.ConfigureDemo();
    }
}